﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MeshSharp.Core.Models;
using NUnit.Framework;

namespace MeshSharp.Core.Tests
{
    [TestFixture]
    public class NavMeshTest
    {

        [Test]
        public void Can_Create_PolyMesh()
        {
            //Setup
            var polyMesh = SampleData.CreateSquare(1,1);
        }

        [Test]
        public void NavMesh_Returns_Same_Path_When_In_Same_Triangle()
        {
            //Setup
            NavMesh polyMesh = SampleData.CreateSquare(1,1);

            Vector3 start = new Vector3(-0.9f, 0.9f, 0);
            Vector3 end = new Vector3(0, 0.1f, 0);

            //Reality
            var path = polyMesh.GetPath(start, end);

            List<Vector3> expected = new List<Vector3>();
            expected.Add(start);
            expected.Add(end);
            CollectionAssert.AreEquivalent(path, expected);
        }

        [Test]
        public void NavMesh_Returns_Same_Path_When_In_Straight_Line()
        {
            //Setup
            NavMesh polyMesh = SampleData.CreateSquare(1, 1);

            Vector3 start = new Vector3(-0.9f, 0.9f, 0);
            Vector3 end = new Vector3(0.9f, -0.9f, 0);

            //Reality
            var path = polyMesh.GetPath(start, end);

            List<Vector3> expected = new List<Vector3>();
            expected.Add(start);
            expected.Add(end);
            CollectionAssert.AreEquivalent(path, expected);
        }

    }
}
